AG-81 - Enhance Command Registry with Extensible Dispatch System#91
Merged
Conversation
rodneyosodo
reviewed
Jun 15, 2026
rodneyosodo
reviewed
Jun 15, 2026
rodneyosodo
reviewed
Jun 15, 2026
rodneyosodo
reviewed
Jun 15, 2026
Enhance the command dispatch system per issue absmach#81: - Add command metadata (name, description, usage) to the registry and a discoverable `help` command that reports it. - Enforce authorization per command via a RequiresAuth flag instead of a single global token gate. - Add `route` command to forward a hex payload to a downstream device interface and return its response. - Extend `control` with stop/start (pause/resume heartbeat, telemetry, and the device scheduler), reload (re-apply persisted config overrides), and status, keeping the existing nodered-* passthrough. - Add `ota,status` to query OTA state over MQTT. - Wire Route through the logging/metrics middleware and regenerate mocks. - Cover the registry, per-command auth, help, route, and control subcommands with tests; document the commands in the README. Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
- Route: resolve the device up front so a missing device returns a clear error instead of an opaque interface-open failure. - controlReload: validate each persisted value before applying, skip and log invalid entries, and report the applied keys for auditability. - controlStart: skip restarting the scheduler when the run context is nil or already cancelled, logging the reason instead of failing silently. - Extend tests for the new reload response and validation behaviour. Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
Document the commands added in this branch now that command docs live under docs/ rather than the README: - control.md: extensible registry + per-command auth note, route and help in the subsystem table, and sections for control lifecycle (stop/start/reload/ status), route, and help. - ota.md: query OTA status via the commands channel (ota,status). Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
- devices.md: note the route command as a one-shot write-then-read to a device interface, linking to its control.md section. - docs/README.md: update the control.md index entry to mention agent lifecycle, route, and help. Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
rodneyosodo
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this do?
Adds an extensible command registry with metadata, a help command, per-command auth, plus route, control lifecycle, and ota status commands.
Which issue(s) does this PR fix/relate to?
Resolves #81
List any changes that modify/break current functionality
None breaking. Authorization moves from a global gate to per-command; all built-ins still require a token.
Have you included tests for your changes?
Yes — registry, per-command auth, help, ota status, route validation, and all control subcommands are covered.
Did you document any new/modified functionality?
Yes — README command table and usage examples updated for help, control, ota status, and route.
Notes
New commands are MQTT-only (SenML), matching the issue format; no HTTP endpoints added.